// ----------------------------------
// RSDK Project: Sonic 1 Forever X Doki Doki Literature Club
// Script Description: BG
// Script Author: Christian Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

//-------Aliases-------//
private alias 1 : TYPE_SEGA
private alias 75 : SPACING_VALUE
public alias 100 : OPTIONS_SLOT
public alias 5 : OPTIONS_DRAWORDER


private alias object.value0 : object.timer
private alias object.value1 : object.xScroll
private alias object.value2 : object.yScroll

// Function declarations

public value DisableDrawRealQuickBuddy = 0;

event ObjectMain
	object.timer++
	if object.timer == 4
		object.xScroll--
		object.yScroll++
		object.xScroll %= SPACING_VALUE
		object.yScroll %= SPACING_VALUE
		object.value0 = 0
	end if
	object.inkEffect = INK_ALPHA
	object.alpha = 100
	CheckEqual(object[33].type, TypeName[Splash])
	temp0 = checkResult
	if temp0 == 1
		object.drawOrder = -1
	else
		object.drawOrder = 1
	end if	

	if object[33].type == TypeName[Warning]
		object.timer = 0
	end if
end event


event ObjectDraw
	if DisableDrawRealQuickBuddy == false
		DrawRect(0, 0, screen.xsize, screen.ysize, color7, color7, color7, 255)	
		if object[33].type == TypeName[Warning]
			SetActivePalette(4, 0, 256)	
		end if
		temp0 = -100
		temp1 = 0
		temp1 -= object.xScroll
		temp2 = -100
		temp2 -= object.yScroll
		temp4 = SPACING_VALUE
		temp4 /= 2
		temp5 = screen.xcenter
		temp5 /= 3
		while temp0 < temp5
			temp3 = 0
			while temp3 < temp5
				DrawSpriteScreenFX(0, FX_INK, temp1, temp2)
				temp1 += SPACING_VALUE
				temp3++
			loop
			temp1 = 0
			temp1 += object.xScroll
			temp3 = temp4
			temp3 *= temp0
			temp1 += temp3
			temp2 += temp4
			temp0++
		loop
		SetActivePalette(0, 0, 256)
		if object[33].type == TypeName[Warning]
			if object[33].state == 5
				if object.value20 < 0
					object.value20 = 0
				else
					object.value20 -= 3
				end if
			else
				object.value20 = 256	
			end if
			DrawRect(0, 0, screen.xsize, screen.ysize, 0, 0, 0, object.value20)		
		end if		
	end if	
end event


event ObjectStartup
	LoadSpriteSheet("DDLCMenu/Menu.gif")
	SpriteFrame(-14, -14, 27, 27, 133, 1)
	SpriteFrame(-8, -8, 16, 16, 360, 60)
end event

event RSDKDraw
	DrawSprite(0)
end event

event RSDKLoad
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-16, -16, 32, 32, 1, 143)
end event
